#pragma once

#include <csignal>
#include "Singleton.h"

#ifndef SIGUSR1
#define SIGUSR1 10
#endif
#ifndef SIGUSR2
#define SIGUSR2 12
#endif
#ifndef SIGCHLD
#define SIGCHLD 17
#endif

namespace Core
{
	void CSignalHandler(int p_SignalNumber);

	class SignalHandler
	{
	public:
		virtual void Handler(int p_SignalNumber) = 0;
		virtual ~SignalHandler() {};
	};

	class Signal : public Singleton<Signal>
	{
		friend class Singleton<Signal>;

	private:
		SignalHandler* m_Handler;

		Signal();

	public:
		SignalHandler* GetHandler();
		void SetHandler(SignalHandler* p_Handler);
		void RegisterSignal(int p_SignalNumber);
	};
}
